import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';

class HeroPage extends StatefulWidget {
  const HeroPage({super.key});

  @override
  State<HeroPage> createState() => _HeroPageState();
}

class _HeroPageState extends State<HeroPage> {
  @override
  Widget build(BuildContext context) {
    // TODO 给组件添加事件，套一层组件 GestureDetector
    return GestureDetector(
      onTap: () {
        Navigator.pop(context);
      },
      onDoubleTap: () {}, //双击
      onLongPress: () {}, //长按
      // ... 还有更多事件
      child: Hero(
        tag: '111',
        child: Scaffold(
          backgroundColor: Colors.black,
          appBar: AppBar(
            title: Text('hero'),
          ),
          body: Center(
            child: AspectRatio(
              aspectRatio: 16 / 9,
              child: PhotoView(
                imageProvider:
                    NetworkImage('https://www.itying.com/images/flutter/4.png'),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
